import http from '@/utils/http'
import convert from '@/utils/model-convert'
import { SearchArgument } from '@/models/customer/platform/survey-result'

const URL = '/rest/customer/platform/survey-results'
const ANSWER_URL = '/rest/customer/platform/survey-results/{id}'

export default {
  list ({search}, cb) {
    http.get(URL, {
      params: convert.toJson(search, SearchArgument)
    }).then(response => cb(response)).catch(trace => cb(trace.response))
  },
  listAnswer ({id}, cb) {
    http.get(ANSWER_URL.replace('{id}', id)).then(response => cb(response)).catch(trace => cb(trace.response))
  }
}
